package qaz.adapter;

import qaz.news.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class IconNewsAdapter extends BaseAdapter {

	// references to our images
		public static final String[] address = { "unknown.vn", "24h.com.vn", "dantri.com.vn",
				"kenh14.vn", "laodong.com.vn", "ngoisao.net", "sucsongmoi.com.vn",
				"vietnamnet.vn", "webtretho.vn", "news.zing.vn", "baodautu.vn",
				"bee.net.vn", "bongda.com.vn", "gdtd.vn", "hoahoctro.vn",
				"infotv.vn", "nhandan.com.vn", "pcworld.com.vn",
				"thanhnien.com.vn", "thethaovanhoa.vn", "tienphong.vn",
				"tuoitrecuoi.com", "vneconomy.vn", "vnexpress.net", "vzone.vn","vnmedia.vn" };
		public static final String[] name = { "TIN TỨC CHUNG", "24H", "DÂN TRÍ", "KÊNH 14",
				"LAO ĐỘNG", "NGÔI SAO", "SỨC SỐNG MỚI", "VIETNAMNET",
				"WEB TRẺ THƠ", "ZING", "BÁO ĐẦU TƯ", "BEE", "BÓNG ĐÁ",
				"GIÁO DỤC THỜI ĐẠI", "HOA HỌC TRÒ", "INFOTV", "NHÂN DÂN",
				"PC WORLD", "THANH NIÊN", "THỂ THAO VĂN HÓA", "TIỀN PHONG",
				"TUỔI TRẺ CƯỜI", "VNECONOMY", "VNEXPRESS", "VZONE", "VN Media"};
		public static final Integer[] mThumbIds = { 
				R.drawable.unknown_vn,
				R.drawable.tin_24h_com_vn, R.drawable.dantri_com_vn,
				R.drawable.kenh14_vn, R.drawable.laodong_com_vn,
				R.drawable.ngoisao_net, R.drawable.sucsongmoi_com_vn,
				R.drawable.vietnamnet_vn, R.drawable.webtretho_vn,
				R.drawable.news_zing_vn, R.drawable.baodautu_vn,
				R.drawable.bee_net_vn, R.drawable.bongda_com_vn,
				R.drawable.gdtd_vn, R.drawable.hoahoctro_vn, R.drawable.infotv_vn,
				R.drawable.nhandan_com_vn, R.drawable.pcworld_com_vn,
				R.drawable.thanhnien_com_vn, R.drawable.thethaovanhoa_vn,
				R.drawable.tienphong_vn, R.drawable.tuoitrecuoi_com,
				R.drawable.vneconomy_vn, R.drawable.vnexpress_net,
				R.drawable.vzone_vn,R.drawable.vnmedia_vn };
	// private Context mContext;
	private LayoutInflater mInflater;

	public IconNewsAdapter(Context c) {
		// mContext = c;
		mInflater = LayoutInflater.from(c);
	}

	public int getCount() {
		return mThumbIds.length;
	}

	public Object getItem(int position) {
		return null;
	}

	public long getItemId(int position) {
		return 0;
	}

	// create a new ImageView for each item referenced by the Adapter
	public View getView(int position, View convertView, ViewGroup parent) {
		// ImageView holderoverlayImage;
		ViewHolder holder;
		if (convertView == null) {
			holder = new ViewHolder();
			convertView = mInflater.inflate(R.layout.overlay_grid_view, null);
			holder.overlayImage = (ImageView) convertView
					.findViewById(R.id.imageViewOverlay);

			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		holder.overlayImage.setImageResource(mThumbIds[position]);
		// holder.overlayName.setText(overlayName[position]);
		return convertView;
	}

	private class ViewHolder {
		// TextView overlayName;
		ImageView overlayImage;
	}

	
}